package com.beiding.workordersystem.system.model;

import com.beiding.workordersystem.system.entity.AccountEntity;
import com.beiding.workordersystem.system.entity.AuthorityEntity;
import com.beiding.workordersystem.system.entity.RoleEntity;
import com.beiding.workordersystem.system.entity.UserEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.Set;

@Getter
@Setter
public class MyCredentials {
    private String username;
    private Set<RoleEntity> roleEntities;
    private Set<String> roles;
    private Set<AuthorityEntity> authorityEntities;
    private Set<String> authorities;
    private UserEntity user;
    private AccountEntity account;

    public boolean hasAuthority(String authority) {
        return authorities.contains(authority);
    }

    public String getUserId() {
        return user.getId();
    }

    public String getAccountId() {
        return account.getId();
    }

}
